// 此函数借用一个 slice
fn analyze_slice(slice: &[i32]) {
    println!("first element of the slice: {}", slice[0]);
    println!("the slice has {} elements", slice.len());
    println!("内容为：{:?}", slice);
}

pub fn array_study_5() {
    let arr: [i32; 5] = [1, 2, 3, 4, 5];

    println!("index: {}", arr[4]);
    println!("长度为: {}", arr.len());
    // analyze_slice(&arr);
    analyze_slice(&arr[1 .. 4]);
    println!("切片之后的长度为: {:?}", arr);
}
